#include "comm/my_time.h"

void test_hrtime()
{
    int64_t cache_time = get_cache_time();
    assert(cache_time != -1);

    DD("cache_time: %ld", cache_time);

    int64_t cur_time = get_latest_time();
    cache_time = get_cache_time();
    DD("cur_time: %ld, cache_time: %ld", cur_time, cache_time);

    int64_t msec = my_usec_2_msec(cache_time);
    assert(msec == cur_time / 1000);

    int64_t sec = my_usec_2_sec(cache_time);
    assert(sec == cur_time / 1000 / 1000);

    my_timespec_t ts;
    my_usec_2_ts(cache_time, &ts);
    int64_t us = my_ts_2_usec(&ts);
    assert(us == cache_time);
}

int main()
{
    test_hrtime();
    return 0;
}